<!DOCTYPE html>
<body>
<script src="/js-test-resources/js-test.js"></script>
<script>
    description("Tests that the order of setting the src of an image element and its crossOrigin attribute doesn't matter");
    jsTestIsAsync = true;

    var img = new Image();
    img.src="http://127.0.0.1:8000/resources/origin.php?1";
    img.crossOrigin = "anonymous";
    var img2 = new Image();
    img2.crossOrigin = "anonymous";
    img2.src="http://127.0.0.1:8000/resources/origin.php?2";

    var srcFirstHasOrigin = false;
    var srcLastHasOrigin = false;
    document.body.onload = function() {
        srcFirstHasOrigin = (img.width == 100)
        shouldBeTrue('srcFirstHasOrigin');
        srcLastHasOrigin = (img2.width == 100)
        shouldBeTrue('srcLastHasOrigin');
        finishJSTest();
    };

</script>
</body>
</html>
